$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    const mstform = $NG.getCmpApi("p_form_kyjfgl_m")
    const dgrid1 = $NG.getCmpApi("p_form_kyjfgl_d1")
    const dgrid2 = $NG.getCmpApi("p_form_kyjfgl_d2")
    const getHeadValue = (str)=>mstform.getItem(str).getValue()

    useUpdateRow(({args})=>{
        const row = args[0]
        row.u_zsrbl = (Number(row.u_yysr) || 0)?(Number(row.u_hj) || 0) / (Number(row.u_yysr) || 0):0
        dgrid1.refreshView()
    },"p_form_kyjfgl_d1")

    useUpdateRows(({args})=>{
        const rows = args[0]
        let total = 0
        rows.forEach(el=>{
            const pbKeys = ["科技研究与发展","合计","营收收入","占收入比例"]
            let lock = true
            pbKeys.forEach(item=>{
                if(!el.s_tree_name.includes(item)){
                    lock = false
                }
            })
            if(!lock){
                total += (Number(el.u_bjdfy) || 0)
            }
            if(el.s_tree_name == '合计'){
                el.u_bjdfy = total
            }
            console.log(`编辑`,el.s_tree_name);
        })
        dgrid2.refreshView()
    },"p_form_kyjfgl_d2")
})